<?php

require_once '../simpletest/autorun.php';
require_once '../simpletest/web_tester.php';
require_once '../../src/useragent/UserAgentFactory.php';

/**
 * <b>UserAgentTest简介:</b>
 * <p>对UserAgent各个平台下的单元测试</p>
 *
 * @author cairq@ucweb.com
 */
class UserAgentTest extends WebTestCase {
    
    function testJava() {
        
        //兼容性测试
        $userAgent = "";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isUnkown()); 
        $this->assertTrue($ua->isEmpty()); 
        
        
        //兼容性测试
        $userAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isUnkown()); 
        $this->assertEqual($ua->getUserAgent(), $userAgent);
        

        //兼容性测试
        $userAgent = "hello, world!";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isUnkown()); 
        $this->assertEqual($ua->getUserAgent(), $userAgent);
        
        
        //兼容性测试, 兼容旧有平台的UA处理
        $userAgent = "NOKIA E71 RM-346/UCWEB6.7.1.1/28/999";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isU2());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertEqual($ua->getDevice(), "NOKIA E71 RM-346");
        
        
        //正确的UA测试
        $userAgent = "UCWEB/2.0(Java; U; MIDP2.0; zh-CN; nokia6300) U2/1.0.0 UCBrowser/8.6.0.199 U2/1.0.0 Mobile";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("nokia6300", $ua->getDevice());
        $this->assertEqual("Java", $ua->getPlatform());
        $this->assertEqual("MIDP", $ua->getOs());
        $this->assertEqual("2.0", $ua->getOsVersion());
        $this->assertEqual("zh-CN", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("8.6.0.199", $ua->getProductVersion());
        $this->assertEqual("U2", $ua->getRenderingEngine());
        $this->assertEqual("1.0.0", $ua->getRenderingEngineVersion());
        $this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_2, $ua->getVersion());
        
        $this->assertTrue($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5()); 
        $this->assertFalse($ua->isWebKit()); 
    }
    
    function testSis() {
        
        //兼容性测试
        $userAgent = "";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isUnkown()); 
        $this->assertTrue($ua->isEmpty()); 
        
        
        //兼容性测试
        $userAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isUnkown()); 
        $this->assertEqual($ua->getUserAgent(), $userAgent);
        

        //兼容性测试
        $userAgent = "hello, world!";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isUnkown()); 
        $this->assertEqual($ua->getUserAgent(), $userAgent);
        
        
        //兼容性测试, 兼容旧有平台的UA处理
        $userAgent = "NOKIA E71 RM-346/UCWEB6.7.1.1/28/999";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isU2());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertEqual($ua->getDevice(), "NOKIA E71 RM-346");
        $this->assertEqual($ua->getVersion(), GlobalConstant::VERSION_1);
        
        //正确的UA测试
        $userAgent = "UCWEB/2.0(Symbian; U; S60 V1; zh-CN; nokia E520) U2/1.0.0 UCBrowser/8.6.0.199  U2/1.0.0 Mobile";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("nokia E520", $ua->getDevice());
        $this->assertEqual("Symbian", $ua->getPlatform());
        $this->assertEqual("S60", $ua->getOs());
        $this->assertEqual("V1", $ua->getOsVersion());
        $this->assertEqual("zh-CN", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("8.6.0.199", $ua->getProductVersion());
        $this->assertEqual("U2", $ua->getRenderingEngine());
        $this->assertEqual("1.0.0", $ua->getRenderingEngineVersion());
        $this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_2, $ua->getVersion());
        
        $this->assertTrue($ua->isSymbian());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertTrue($ua->isS60()); 
        $this->assertTrue($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5()); 
        $this->assertFalse($ua->isWebKit()); 
        
        //正确的UA测试
        $userAgent = "UCWEB/2.0(Symbian; U; S60 V2; zh-CN; nokia E520) U2/1.0.0 UCBrowser/8.6.0.199  U2/1.0.0 Mobile";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("nokia E520", $ua->getDevice());
        $this->assertEqual("Symbian", $ua->getPlatform());
        $this->assertEqual("S60", $ua->getOs());
        $this->assertEqual("V2", $ua->getOsVersion());
        $this->assertEqual("zh-CN", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("8.6.0.199", $ua->getProductVersion());
        $this->assertEqual("U2", $ua->getRenderingEngine());
        $this->assertEqual("1.0.0", $ua->getRenderingEngineVersion());
        $this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_2, $ua->getVersion());
        
        $this->assertTrue($ua->isSymbian());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertTrue($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertTrue($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5()); 
        $this->assertFalse($ua->isWebKit()); 
        
        //正确的UA测试
        $userAgent = "UCWEB/2.0(Symbian; U; S60 V3; zh-CN; nokia E520) U2/1.0.0 UCBrowser/8.6.0.199  U2/1.0.0 Mobile";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("nokia E520", $ua->getDevice());
        $this->assertEqual("Symbian", $ua->getPlatform());
        $this->assertEqual("S60", $ua->getOs());
        $this->assertEqual("V3", $ua->getOsVersion());
        $this->assertEqual("zh-CN", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("8.6.0.199", $ua->getProductVersion());
        $this->assertEqual("U2", $ua->getRenderingEngine());
        $this->assertEqual("1.0.0", $ua->getRenderingEngineVersion());
        $this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_2, $ua->getVersion());
        
        $this->assertTrue($ua->isSymbian());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertTrue($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertTrue($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5());  
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5()); 
        $this->assertFalse($ua->isWebKit()); 
        
        //正确的UA测试
        $userAgent = "UCWEB/2.0(Symbian; U; S60 V5; zh-CN; nokia E520) U2/1.0.0 UCBrowser/8.6.0.199  U2/1.0.0 Mobile";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("nokia E520", $ua->getDevice());
        $this->assertEqual("Symbian", $ua->getPlatform());
        $this->assertEqual("S60", $ua->getOs());
        $this->assertEqual("V5", $ua->getOsVersion());
        $this->assertEqual("zh-CN", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("8.6.0.199", $ua->getProductVersion());
        $this->assertEqual("U2", $ua->getRenderingEngine());
        $this->assertEqual("1.0.0", $ua->getRenderingEngineVersion());
        $this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_2, $ua->getVersion());
        
        $this->assertTrue($ua->isSymbian());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertTrue($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertTrue($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5()); 
        $this->assertFalse($ua->isWebKit()); 
    }
    
    function testAndroid() {
        
        //兼容性测试
        $userAgent = "";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isUnkown()); 
        $this->assertTrue($ua->isEmpty()); 
        
        
        //兼容性测试
        $userAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isUnkown()); 
        $this->assertEqual($ua->getUserAgent(), $userAgent);
        

        //兼容性测试
        $userAgent = "hello, world!";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isUnkown()); 
        $this->assertEqual($ua->getUserAgent(), $userAgent);
        
        
        //兼容性测试, 兼容旧有平台的UA处理
        $userAgent = "NOKIA E71 RM-346/UCWEB6.7.1.1/28/999";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isU2());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertEqual($ua->getDevice(), "NOKIA E71 RM-346");
        
        
        //正确的UA测试, U2自有内核测试
        $userAgent = "UCWEB/2.0(Linux; U; Adr 2.3; en-US; MI-ONEPlus) U2/1.0.0 UCBrowser/8.6.0.199 U2/1.0.0 Mobile";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("MI-ONEPlus", $ua->getDevice());
        $this->assertEqual("Linux", $ua->getPlatform());
        $this->assertEqual("Adr", $ua->getOs());
        $this->assertEqual("2.3", $ua->getOsVersion());
        $this->assertEqual("en-US", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("8.6.0.199", $ua->getProductVersion());
        $this->assertEqual("U2", $ua->getRenderingEngine());
        $this->assertEqual("1.0.0", $ua->getRenderingEngineVersion());
        $this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_2, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertTrue($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertTrue($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5()); 
        $this->assertFalse($ua->isWebKit()); 
        
        //正确的UA测试, U3自有测试
        $userAgent = "Mozilla/5.0(Linux; U; Android 2.3; zh-CN; MI-ONEPlus) AppleWebKit/534.13 (KHTML, like Gecko) UCBrowser/8.6.0.199 U3/0.8.0 Mobile Safari/534.13";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("MI-ONEPlus", $ua->getDevice());
        $this->assertEqual("Linux", $ua->getPlatform());
        $this->assertEqual("Android", $ua->getOs());
        $this->assertEqual("2.3", $ua->getOsVersion());
        $this->assertEqual("zh-CN", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("8.6.0.199", $ua->getProductVersion());
        $this->assertEqual("AppleWebKit", $ua->getRenderingEngine());
        $this->assertEqual("534.13", $ua->getRenderingEngineVersion());
        $this->assertEqual("U3", $ua->getUcPlatform());
        $this->assertEqual("0.8.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_2, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertTrue($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertTrue($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertTrue($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertTrue($ua->isSupperHtml5()); 
        
        
        //正确的UA测试, U2自带浏览器内核测试
        $userAgent = "Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13 UCBrowser/8.6.0.199 U2/1.0.0 Mobile";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("Xoom Build/HRI39", $ua->getDevice());
        $this->assertEqual("Linux", $ua->getPlatform());
        $this->assertEqual("Android", $ua->getOs());
        $this->assertEqual("3.0", $ua->getOsVersion());
        $this->assertEqual("en-us", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("8.6.0.199", $ua->getProductVersion());
        $this->assertEqual("AppleWebKit", $ua->getRenderingEngine());
        $this->assertEqual("534.13", $ua->getRenderingEngineVersion());
        $this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_2, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertTrue($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertTrue($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertTrue($ua->isSupperHtml5());
        
        //正确的JUC测试, U2自带浏览器内核测试
        $userAgent = "JUC(Linux;U;AndroidVersion;Language;Model;ScreenWide*ScreenHeight;) UCBrowser8.6.0.199/69/999";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("Model", $ua->getDevice());
        $this->assertEqual("Linux", $ua->getPlatform());
        $this->assertEqual("AndroidVersion", $ua->getOs());
        $this->assertEqual("", $ua->getOsVersion());
        $this->assertEqual("Language", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("8.6.0.199", $ua->getProductVersion());
        $this->assertEqual("", $ua->getRenderingEngine());
        $this->assertEqual("", $ua->getRenderingEngineVersion());
        $this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
   
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertFalse($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertTrue($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertTrue($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5());
        
        
        //正确的UA测试, U2自带浏览器内核测试
        $userAgent = "JUC (Linux;U;AndroidVersion;Language;Model;ScreenWide*ScreenHeight;)";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("Model", $ua->getDevice());
        $this->assertEqual("Linux", $ua->getPlatform());
        $this->assertEqual("AndroidVersion", $ua->getOs());
        $this->assertEqual("", $ua->getOsVersion());
        $this->assertEqual("Language", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("", $ua->getProductVersion());
        $this->assertEqual("", $ua->getRenderingEngine());
        $this->assertEqual("", $ua->getRenderingEngineVersion());
        $this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
     
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertFalse($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertTrue($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertTrue($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5());
    }
    
    function testiPhone() {
        
        //兼容性测试
        $userAgent = "";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isUnkown()); 
        $this->assertTrue($ua->isEmpty()); 
        
        
        //兼容性测试
        $userAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isUnkown()); 
        $this->assertEqual($ua->getUserAgent(), $userAgent);
        

        //兼容性测试
        $userAgent = "hello, world!";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isUnkown()); 
        $this->assertEqual($ua->getUserAgent(), $userAgent);
        
        
        //兼容性测试, 兼容旧有平台的UA处理
        $userAgent = "NOKIA E71 RM-346/UCWEB6.7.1.1/28/999";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isU2());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertEqual($ua->getDevice(), "NOKIA E71 RM-346");
        
        
        //正确的UA测试, U2自有内核测试
        $userAgent = "UCWEB/2.0(iOS; U; iPh 4_3_2; zh-CN; iPh4) U2/1.0.0  UCBrowser/8.6.0.199 U2/1.0.0 Mobile";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("iPh4", $ua->getDevice());
        $this->assertEqual("iOS", $ua->getPlatform());
        $this->assertEqual("iPh", $ua->getOs());
        $this->assertEqual("4_3_2", $ua->getOsVersion());
        $this->assertEqual("zh-CN", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("8.6.0.199", $ua->getProductVersion());
        $this->assertEqual("U2", $ua->getRenderingEngine());
        $this->assertEqual("1.0.0", $ua->getRenderingEngineVersion());
        $this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_2, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertTrue($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertTrue($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertTrue($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5()); 
        $this->assertFalse($ua->isWebKit()); 
        
        //正确的UA测试, U3自有测试
        $userAgent = "Mozilla/5.0(iOS; U;  iPhone 4; zh-CN; iPhone4) AppleWebKit/534.13 (KHTML, like Gecko) UCBrowser/8.6.0.199 U3/0.8.0 Mobile Safari/534.13";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("iPhone4", $ua->getDevice());
        $this->assertEqual("iOS", $ua->getPlatform());
        $this->assertEqual("iPhone", $ua->getOs());
        $this->assertEqual("4", $ua->getOsVersion());
        $this->assertEqual("zh-CN", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("8.6.0.199", $ua->getProductVersion());
        $this->assertEqual("AppleWebKit", $ua->getRenderingEngine());
        $this->assertEqual("534.13", $ua->getRenderingEngineVersion());
        $this->assertEqual("U3", $ua->getUcPlatform());
        $this->assertEqual("0.8.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_2, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertTrue($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertTrue($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertTrue($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertTrue($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertTrue($ua->isSupperHtml5()); 
        
        
        //正确的UA测试, U2自带浏览器内核测试
        $userAgent = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5 UCBrowser/8.6.0.199 U2/1.0.0 Mobile";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("", $ua->getDevice());
        $this->assertEqual("iPhone", $ua->getPlatform());
        $this->assertEqual("CPU iPhone OS", $ua->getOs());
        $this->assertEqual("4_3_2 like Mac OS X", $ua->getOsVersion());
        $this->assertEqual("en-us", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("8.6.0.199", $ua->getProductVersion());
        $this->assertEqual("AppleWebKit", $ua->getRenderingEngine());
        $this->assertEqual("533.17.9", $ua->getRenderingEngineVersion());
        $this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_2, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertTrue($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertTrue($ua->isSupperHtml5());
        
        
        //正确的JUC测试, U2自带浏览器内核测试
        $userAgent = "IUC(U;iOS_Version;Language;ScreenWide*ScreenHeight;)";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("iPhone", $ua->getDevice());
        $this->assertEqual("iOS", $ua->getPlatform());
        $this->assertEqual("iOS_Version", $ua->getOs());
        $this->assertEqual("", $ua->getOsVersion());
        $this->assertEqual("Language", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("", $ua->getProductVersion());
        $this->assertEqual("", $ua->getRenderingEngine());
        $this->assertEqual("", $ua->getRenderingEngineVersion());
        $this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
   
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertFalse($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertTrue($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertTrue($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5());
        
        
        //正确的UA测试, U2自带浏览器内核测试
        $userAgent = "IUC(U;iOS_Version;Language;ScreenWide*ScreenHeight;) UCBrowser8.6.0.199/PFID/BID";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("iPhone", $ua->getDevice());
        $this->assertEqual("iOS", $ua->getPlatform());
        $this->assertEqual("iOS_Version", $ua->getOs());
        $this->assertEqual("", $ua->getOsVersion());
        $this->assertEqual("Language", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("8.6.0.199", $ua->getProductVersion());
        $this->assertEqual("", $ua->getRenderingEngine());
        $this->assertEqual("", $ua->getRenderingEngineVersion());
        $this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
     
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertFalse($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertTrue($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertTrue($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5());
    }
    
    function testWP() {
        
        //兼容性测试
        $userAgent = "";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isUnkown()); 
        $this->assertTrue($ua->isEmpty()); 
        
        
        //兼容性测试
        $userAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isUnkown()); 
        $this->assertEqual($ua->getUserAgent(), $userAgent);
        

        //兼容性测试
        $userAgent = "hello, world!";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isUnkown()); 
        $this->assertEqual($ua->getUserAgent(), $userAgent);
        
        
        //兼容性测试, 兼容旧有平台的UA处理
        $userAgent = "NOKIA E71 RM-346/UCWEB6.7.1.1/28/999";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertTrue($ua->isU2());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertEqual($ua->getDevice(), "NOKIA E71 RM-346");
        
        
        //正确的UA测试, U2自有内核测试
        $userAgent = "UCWEB/2.0(Windows; U; WP 8; zh-CN; Nokia 9000) U2/1.0.0 UCBrowser/8.6.0.199 U2/1.0.0 Mobile ";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("Nokia 9000", $ua->getDevice());
        $this->assertEqual("Windows", $ua->getPlatform());
        $this->assertEqual("WP", $ua->getOs());
        $this->assertEqual("8", $ua->getOsVersion());
        $this->assertEqual("zh-CN", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("8.6.0.199", $ua->getProductVersion());
        $this->assertEqual("U2", $ua->getRenderingEngine());
        $this->assertEqual("1.0.0", $ua->getRenderingEngineVersion());
        $this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_2, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertTrue($ua->isWindows()); 
        $this->assertTrue($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5()); 
        $this->assertFalse($ua->isWebKit()); 
        
        //正确的UA测试, U3自有测试
        $userAgent = "Mozilla/5.0(Windows; U;  WP 8; zh-CN; Nokia 9700) AppleWebKit/534.13 (KHTML, like Gecko) UCBrowser/8.6.0.199 U3/0.8.0 Mobile Safari/534.13";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("Nokia 9700", $ua->getDevice());
        $this->assertEqual("Windows", $ua->getPlatform());
        $this->assertEqual("WP", $ua->getOs());
        $this->assertEqual("8", $ua->getOsVersion());
        $this->assertEqual("zh-CN", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("8.6.0.199", $ua->getProductVersion());
        $this->assertEqual("AppleWebKit", $ua->getRenderingEngine());
        $this->assertEqual("534.13", $ua->getRenderingEngineVersion());
        $this->assertEqual("U3", $ua->getUcPlatform());
        $this->assertEqual("0.8.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_2, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertTrue($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertTrue($ua->isWindows()); 
        $this->assertTrue($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertTrue($ua->isSupperHtml5()); 
        
        //正确的UA测试, U2自带浏览器内核测试
        $userAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; Microsoft; XDeviceEmulator) UCBrowser/8.6.0.199 U2/1.0.0 Mobile";
        $ua = UserAgentFactory::createUserAgent($userAgent);
        
        $this->assertEqual("", $ua->getDevice());
        $this->assertEqual("Windows Phone OS 7.5", $ua->getPlatform());
        $this->assertEqual("Windows Phone OS 7.5", $ua->getOs());
        $this->assertEqual("", $ua->getOsVersion());
        $this->assertEqual("", $ua->getLanguage());
        $this->assertEqual("UCBrowser", $ua->getProduct());
        $this->assertEqual("8.6.0.199", $ua->getProductVersion());
        $this->assertEqual("Trident", $ua->getRenderingEngine());
        $this->assertEqual("5.0", $ua->getRenderingEngineVersion());
        $this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_2, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertFalse($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertTrue($ua->isWindows()); 
        $this->assertTrue($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertTrue($ua->isSupperHtml5());
    }
    
    function testJava8_7to8_8(){
    	$userAgent = "UCWEB/2.0(Java; U; MIDP-2.0; en-us; sunmicrosystems_wtk) U2/1.0.0 UCBrowser/8.7.1.234 U2/1.0.0 Mobile";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("Java", $ua->getPlatform());
    	$this->assertEqual("U", $ua->getEncryption());
    	$this->assertEqual("en-us", $ua->getLanguage());
    	$this->assertEqual("MIDP-", $ua->getOs());
    	$this->assertEqual("2.0", $ua->getOsVersion());
    	$this->assertEqual("sunmicrosystems_wtk", $ua->getDevice());
    	$this->assertEqual("U2", $ua->getRenderingEngine());
    	$this->assertEqual("1.0.0", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("8.7.1.234", $ua->getProductVersion());
    	$this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_2, $ua->getVersion());
        
        $this->assertTrue($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5());
    }

    
    function testJava8_5to8_6(){
    	$userAgent = "Mozilla/5.0 (Java; U; en-us; NOKIAE50) AppleWebKit/530.13 (KHTML, like Gecko) UCBrowser/8.5.0.185/82/352/UCWEB Mobile";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("Java", $ua->getPlatform());
    	$this->assertEqual("U", $ua->getEncryption());
    	$this->assertEqual("en-us", $ua->getLanguage());
    	$this->assertEqual("", $ua->getOs());
    	$this->assertEqual("NOKIAE50", $ua->getDevice());
    	$this->assertEqual("AppleWebKit", $ua->getRenderingEngine());
    	$this->assertEqual("530.13", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("8.5.0.185", $ua->getProductVersion());
    	$this->assertEqual("", $ua->getUcPlatform());
        $this->assertEqual("", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertTrue($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertTrue($ua->isSupperHtml5());
    }
    
    
    function testJava8_2to8_4(){
    	$userAgent = "Mozilla/5.0 (Java; U; en-in; NOKIAE50) UCBrowser 8.2.1.144/69/352/UCWEB Mobile";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("Java", $ua->getPlatform());
    	$this->assertEqual("U", $ua->getEncryption());
    	$this->assertEqual("en-in", $ua->getLanguage());
    	$this->assertEqual("", $ua->getOs());
    	$this->assertEqual("NOKIAE50", $ua->getDevice());
    	$this->assertEqual("", $ua->getRenderingEngine());
    	$this->assertEqual("", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("8.2.1.144", $ua->getProductVersion());
    	$this->assertEqual("", $ua->getUcPlatform());
        $this->assertEqual("", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertTrue($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5());
    }
    
    
    function testJava8_0_3(){
    	$userAgent = "NOKIAE50/UC Browser8.0.3.107/69/352 UNTRUSTED/1.0";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("", $ua->getPlatform());
    	$this->assertEqual("", $ua->getEncryption());
    	$this->assertEqual("", $ua->getLanguage());
    	$this->assertEqual("", $ua->getOs());
    	$this->assertEqual("NOKIAE50", $ua->getDevice());
    	$this->assertEqual("", $ua->getRenderingEngine());
    	$this->assertEqual("", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("8.0.3.107", $ua->getProductVersion());
    	$this->assertEqual("", $ua->getUcPlatform());
        $this->assertEqual("", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertFalse($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertFalse($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5());
    }
    
    
    
    function testJava7_9_0(){
    	$userAgent = "NOKIAE50/UC Browser7.9.0.102/70/352";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("", $ua->getPlatform());
    	$this->assertEqual("", $ua->getEncryption());
    	$this->assertEqual("", $ua->getLanguage());
    	$this->assertEqual("", $ua->getOs());
    	$this->assertEqual("NOKIAE50", $ua->getDevice());
    	$this->assertEqual("", $ua->getRenderingEngine());
    	$this->assertEqual("", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("7.9.0.102", $ua->getProductVersion());
    	$this->assertEqual("", $ua->getUcPlatform());
        $this->assertEqual("", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertFalse($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertFalse($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5());
    }
    
    
    function testBlackberry7_8_0(){
    	$userAgent = "BlackBerry9500/2.13.0.54 Profile/MIDP-2.0 Configuration/CLDC-1.1/UC Browser7.8.0.95/161/351";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("", $ua->getPlatform());
    	$this->assertEqual("", $ua->getEncryption());
    	$this->assertEqual("", $ua->getLanguage());
    	$this->assertEqual("", $ua->getOs());
    	$this->assertEqual("BlackBerry9500", $ua->getDevice());
    	$this->assertEqual("", $ua->getRenderingEngine());
    	$this->assertEqual("", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("7.8.0.95", $ua->getProductVersion());
    	$this->assertEqual("", $ua->getUcPlatform());
        $this->assertEqual("", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertFalse($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertFalse($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5());
    }
    
    
    function testSymbian7_9to8_0(){
    	$userAgent = "NOKIAE50/UC Browser7.9.0.102/28/352/UCWEB";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("", $ua->getPlatform());
    	$this->assertEqual("", $ua->getEncryption());
    	$this->assertEqual("", $ua->getLanguage());
    	$this->assertEqual("", $ua->getOs());
    	$this->assertEqual("NOKIAE50", $ua->getDevice());
    	$this->assertEqual("", $ua->getRenderingEngine());
    	$this->assertEqual("", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("7.9.0.102", $ua->getProductVersion());
    	$this->assertEqual("", $ua->getUcPlatform());
        $this->assertEqual("", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertFalse($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertFalse($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5());
    }
    
    
    function testSymbian8_2to8_5(){
    	$userAgent = "Mozilla/5.0 (Platform; U;en-us;NokiaE51) UCBrowser8.2.0.132/28/352/UCWEB Mobile";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("Platform", $ua->getPlatform());
    	$this->assertEqual("U", $ua->getEncryption());
    	$this->assertEqual("en-us", $ua->getLanguage());
    	$this->assertEqual("", $ua->getOs());
    	$this->assertEqual("NokiaE51", $ua->getDevice());
    	$this->assertEqual("", $ua->getRenderingEngine());
    	$this->assertEqual("", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("8.2.0.132", $ua->getProductVersion());
    	$this->assertEqual("", $ua->getUcPlatform());
        $this->assertEqual("", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5());
    }
    
    
    function testSymbian8_6_0(){
    	$userAgent = "Mozilla/5.0 (Symbian3; U; en-us;Nokia E6-00) AppleWebKit/530.13(KHTML, like Gecko) UCBrowser/8.6.0.199/51/352/UCWEB Mobile";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("Symbian3", $ua->getPlatform());
    	$this->assertEqual("U", $ua->getEncryption());
    	$this->assertEqual("en-us", $ua->getLanguage());
    	$this->assertEqual("", $ua->getOs());
    	$this->assertEqual("Nokia E6-00", $ua->getDevice());
    	$this->assertEqual("AppleWebKit", $ua->getRenderingEngine());
    	$this->assertEqual("530.13", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("8.6.0.199", $ua->getProductVersion());
    	$this->assertEqual("", $ua->getUcPlatform());
        $this->assertEqual("", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertTrue($ua->isSymbian()); 
        $this->assertTrue($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertTrue($ua->isSupperHtml5());
    }
    
    
    function testSymbian8_7_0(){
    	$userAgent = "Mozilla/5.0 (S60V3; U; en-us; NOKIAE5-00) AppleWebKit/530.13 (KHTML, like Gecko) UCBrowser/8.7.1.234/28/352/UCWEB Mobile";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("S60V3", $ua->getPlatform());
    	$this->assertEqual("U", $ua->getEncryption());
    	$this->assertEqual("en-us", $ua->getLanguage());
    	$this->assertEqual("", $ua->getOs());
    	$this->assertEqual("NOKIAE5-00", $ua->getDevice());
    	$this->assertEqual("AppleWebKit", $ua->getRenderingEngine());
    	$this->assertEqual("530.13", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("8.7.1.234", $ua->getProductVersion());
    	$this->assertEqual("", $ua->getUcPlatform());
        $this->assertEqual("", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertFalse($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertFalse($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertTrue($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertTrue($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertTrue($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertTrue($ua->isSupperHtml5());
    }
    
    
    function testAndroid8_5(){
    	$userAgent = "Mozilla/5.0 (Linux; U; Android 2.3.5; en-us ; MI-ONE Plus Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1/UCBrowser/8.4.0.181/145/352";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("Linux", $ua->getPlatform());
    	$this->assertEqual("U", $ua->getEncryption());
    	$this->assertEqual("en-us", $ua->getLanguage());
    	$this->assertEqual("Android", $ua->getOs());
    	$this->assertEqual("2.3.5", $ua->getOsVersion());
    	$this->assertEqual("MI-ONE Plus Build/GINGERBREAD", $ua->getDevice());
    	$this->assertEqual("AppleWebKit", $ua->getRenderingEngine());
    	$this->assertEqual("533.1", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("8.4.0.181", $ua->getProductVersion());
    	$this->assertEqual("", $ua->getUcPlatform());
        $this->assertEqual("", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertTrue($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertTrue($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertTrue($ua->isSupperHtml5());
    }
    
    
    function testAndroid8_2to8_4(){
    	$userAgent = "Mozilla/5.0 (Linux; U; Android 2.3.5; en-us ; MI-ONE Plus Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1/UCBrowser/8.4.0.181/145/352";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("Linux", $ua->getPlatform());
    	$this->assertEqual("U", $ua->getEncryption());
    	$this->assertEqual("en-us", $ua->getLanguage());
    	$this->assertEqual("Android", $ua->getOs());
    	$this->assertEqual("2.3.5", $ua->getOsVersion());
    	$this->assertEqual("MI-ONE Plus Build/GINGERBREAD", $ua->getDevice());
    	$this->assertEqual("AppleWebKit", $ua->getRenderingEngine());
    	$this->assertEqual("533.1", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("8.4.0.181", $ua->getProductVersion());
    	$this->assertEqual("", $ua->getUcPlatform());
        $this->assertEqual("", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertTrue($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertTrue($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertTrue($ua->isSupperHtml5());
    }
    
    
    function testAndroid8_0(){
    	$userAgent = "Mozilla/5.0 (Linux; U; Android 2.3.5; zh-cn; MI-ONE Plus Build/GINGERBREAD) UC AppleWebKit/530+ (KHTML, like Gecko) Mobile Safari/530/";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("Linux", $ua->getPlatform());
    	$this->assertEqual("U", $ua->getEncryption());
    	$this->assertEqual("zh-cn", $ua->getLanguage());
    	$this->assertEqual("Android", $ua->getOs());
    	$this->assertEqual("2.3.5", $ua->getOsVersion());
    	$this->assertEqual("MI-ONE Plus Build/GINGERBREAD", $ua->getDevice());
    	$this->assertEqual("AppleWebKit", $ua->getRenderingEngine());
    	$this->assertEqual("530+", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("", $ua->getProductVersion());
    	$this->assertEqual("", $ua->getUcPlatform());
        $this->assertEqual("", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertTrue($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertTrue($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertTrue($ua->isSupperHtml5());
    }
    
    
    function testAndroid7_8(){
    	$userAgent = "JUC(Linux;U;Android2.3.5;Zh_cn;MI-ONE Plus;480*854;)UCBrowser/7.8.0.95/139/351";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("Linux", $ua->getPlatform());
    	$this->assertEqual("U", $ua->getEncryption());
    	$this->assertEqual("Zh_cn", $ua->getLanguage());
    	$this->assertEqual("Android", $ua->getOs());
    	$this->assertEqual("2.3.5", $ua->getOsVersion());
    	$this->assertEqual("MI-ONE Plus", $ua->getDevice());
    	$this->assertEqual("", $ua->getRenderingEngine());
    	$this->assertEqual("", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("7.8.0.95", $ua->getProductVersion());
    	$this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertFalse($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertTrue($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertTrue($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5());
    }
    
    
    function testAndroid7_8U2_Kernel(){
    	$userAgent = "JUC(Linux;U;Android2.3.5;Zh_cn;MI-ONE Plus;480*854;)UCBrowser/7.8.0.95/139/351";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("Linux", $ua->getPlatform());
    	$this->assertEqual("U", $ua->getEncryption());
    	$this->assertEqual("Zh_cn", $ua->getLanguage());
    	$this->assertEqual("Android", $ua->getOs());
    	$this->assertEqual("2.3.5", $ua->getOsVersion());
    	$this->assertEqual("MI-ONE Plus", $ua->getDevice());
    	$this->assertEqual("", $ua->getRenderingEngine());
    	$this->assertEqual("", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("7.8.0.95", $ua->getProductVersion());
    	$this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertFalse($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertTrue($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertTrue($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5());
    }
    
    
    function testAndroid7_8Webkit(){
    	$userAgent = "Mozilla/5.0(Linux;U;Android2.3.5;Zh_cn;MI-ONE Plus;480*854;)AppleWebKit/528.5+ (KHTML) UCBrowser/7.8.0.95/139/351 Mobile";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("Linux", $ua->getPlatform());
    	$this->assertEqual("U", $ua->getEncryption());
    	$this->assertEqual("Zh_cn", $ua->getLanguage());
    	$this->assertEqual("Android", $ua->getOs());
    	$this->assertEqual("2.3.5", $ua->getOsVersion());
    	$this->assertEqual("MI-ONE Plus", $ua->getDevice());
    	$this->assertEqual("AppleWebKit", $ua->getRenderingEngine());
    	$this->assertEqual("528.5+", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("7.8.0.95", $ua->getProductVersion());
    	$this->assertEqual("", $ua->getUcPlatform());
        $this->assertEqual("", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertTrue($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertTrue($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertTrue($ua->isSupperHtml5());
    }
    
    
    function testAndroid8_0_Mini_U2_Kernel(){
    	$userAgent = "JUC(Linux;U;Android2.3.5;Zh_cn;MI-ONE Plus;480*854;)UCWEB/7.9.0.94/139/444";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("Linux", $ua->getPlatform());
    	$this->assertEqual("U", $ua->getEncryption());
    	$this->assertEqual("Zh_cn", $ua->getLanguage());
    	$this->assertEqual("Android", $ua->getOs());
    	$this->assertEqual("2.3.5", $ua->getOsVersion());
    	$this->assertEqual("MI-ONE Plus", $ua->getDevice());
    	$this->assertEqual("", $ua->getRenderingEngine());
    	$this->assertEqual("", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("7.9.0.94", $ua->getProductVersion());
    	$this->assertEqual("U2", $ua->getUcPlatform());
        $this->assertEqual("1.0.0", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertTrue($ua->isU2());
        $this->assertFalse($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertTrue($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertTrue($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertFalse($ua->isSupperHtml5());
    }
    
    
    function testAndroid8_0_Webkit_Kernel(){
    	$userAgent = "Mozilla/5.0(Linux;U;Android2.3.5;Zh_cn;MI-ONE Plus;480*854;)AppleWebKit/528.5+ (KHTML,like Gecko) Version/3.1.2 Mobile Safari/525.20.1/UCWEB7.9.0.94/139/444";
    	$ua = UserAgentFactory::createUserAgent($userAgent);
    	$this->assertEqual("Linux", $ua->getPlatform());
    	$this->assertEqual("U", $ua->getEncryption());
    	$this->assertEqual("Zh_cn", $ua->getLanguage());
    	$this->assertEqual("Android", $ua->getOs());
    	$this->assertEqual("2.3.5", $ua->getOsVersion());
    	$this->assertEqual("MI-ONE Plus", $ua->getDevice());
    	$this->assertEqual("AppleWebKit", $ua->getRenderingEngine());
    	$this->assertEqual("528.5+", $ua->getRenderingEngineVersion());
    	$this->assertEqual("UCBrowser", $ua->getProduct());
    	$this->assertEqual("7.9.0.94", $ua->getProductVersion());
    	$this->assertEqual("", $ua->getUcPlatform());
        $this->assertEqual("", $ua->getUcPlatformVersion());
        $this->assertEqual(GlobalConstant::VERSION_1, $ua->getVersion());
        
        $this->assertFalse($ua->isJava());
        $this->assertTrue($ua->isSafe());
        $this->assertFalse($ua->isU2());
        $this->assertTrue($ua->isMobileMode());
        $this->assertFalse($ua->isU3());
        $this->assertFalse($ua->isUnkown()); 
        $this->assertFalse($ua->isEmpty()); 
        $this->assertTrue($ua->isAndroid());
        $this->assertFalse($ua->isApad());
        $this->assertFalse($ua->isBrew());
        $this->assertFalse($ua->isEmpty());
        $this->assertFalse($ua->isiOS()); 
        $this->assertFalse($ua->isiPad()); 
        $this->assertFalse($ua->isiPhone()); 
        $this->assertFalse($ua->isiPhone1()); 
        $this->assertFalse($ua->isiPhone2()); 
        $this->assertFalse($ua->isiPhone3()); 
        $this->assertFalse($ua->isiPhone4()); 
        $this->assertFalse($ua->isiPhone5()); 
        $this->assertTrue($ua->isLinux()); 
        $this->assertFalse($ua->isMTK());  
        $this->assertFalse($ua->isS60()); 
        $this->assertFalse($ua->isS60V1()); 
        $this->assertFalse($ua->isS60V2()); 
        $this->assertFalse($ua->isS60V3()); 
        $this->assertFalse($ua->isS60V5()); 
        $this->assertFalse($ua->isSymbian()); 
        $this->assertFalse($ua->isSymbian3()); 
        $this->assertFalse($ua->isWindows()); 
        $this->assertFalse($ua->isWP()); 
        $this->assertFalse($ua->isWinPad()); 
        $this->assertTrue($ua->isSupperHtml5());
    }
}

?>
